<?php

namespace app\controller;

use app\BaseController;
use think\facade\View;
use app\utils\Utils;
use think\facade\Cache;
use app\model\Log;


class Game extends BaseController
{
    static public function index()
    {
        //
    }

    static public function dumpling()
    {
        return View::fetch('game/dumpling', ['all' => Cache::get('all', 0)]);
    }

    static public function add()
    {
        $ip = Utils::getIp();
        $time = Cache::get($ip, false);
        if (!$time) {
            Cache::set($ip, 0, 10);
            Cache::set('all', Cache::get('all', 0) + 1, 0);
            return json(array('code' => 200, 'data' => Cache::get('all', 0) + 1));
        } else {
            return json(array('code' => 403));
        }
    }
}
